<template>
	<view>
		<u-card :thumb="base+reactive.avatarUrl" :title="reactive.name">
			<view slot="body">
				<view>从业年限时间：{{reactive.workStartAt}}</view>
				<view>服务人数：{{reactive.serviceTimes}}</view>
				<view>咨询人数：{{reactive.serviceTimes}}</view>
				<view>法律专长：{{reactive.legalExpertiseName}}</view>
				<view>好评率：{{reactive.favorableRate}}%</view>
			</view>
		</u-card>
		<uni-group>
			<view class="wrap">
				<view class="u-tabs-box">
					<u-tabs-swiper activeColor="#f29100" ref="tabs" :list="list" :current="current" @change="change" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
				</view>
				<swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
					<swiper-item class="swiper-item">
						<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
							<br>
							<image src="" style="width: 90%;border: 1px solid black;"></image>
							<view>教育背景：{{reactive.eduInfo}}</view>
							<br/>
							<view>个人简历：{{reactive.baseInfo}}</view>
						</scroll-view>
					</swiper-item>
				
					<swiper-item class="swiper-item">
						<scroll-view scroll-y style="height: 100%;width: 100%;">
							<view class="comment" v-for="(res, index) in commentList" :key="res.id">
										<view class="left"><image :src="base+res.fromUserAvatar" mode="aspectFill"></image></view>
										<view class="right">
											<view class="top">
												<view class="name">{{ res.fromUserName }}</view>
												<view class="like" :class="{ highlight: res.myLikeState }">
													<view class="num">{{ res.likeCount }}</view>
													<u-icon v-if="!res.myLikeState" name="thumb-up" :size="30" color="#9a9a9a" @click="getLike(index)"></u-icon>
													<u-icon v-if="res.myLikeState" name="thumb-up-fill" :size="30" @click="getLike(index)"></u-icon>
												</view>
											</view>
											<view class="content">{{ res.evaluateContent }}</view>
											
											<view class="bottom">
												{{ res.createTime }}
												<view class="reply">回复</view>
											</view>
										</view>
									</view>
						</scroll-view>
					</swiper-item>
					
				</swiper>
			</view>
			
		</uni-group>
		<uni-group style="position: fixed;bottom: 0%;right: 0%;left: 0%;">
			<button type="primary" @click="toxia(reactive.id)">免费咨询</button>
		</uni-group>
	</view>
</template>

<script>
	import api from 'commer/apiURL.js'
	export default {
		data() {
			return {
				base:api.baseurl,
				reactive:'',
				commentList:[],
				list: [
					{
						name: '基本信息'
					},
					{
						name: '评价'
					},
					
				],
				current: 0,
				swiperCurrent: 0,
				tabsHeight: 0,
				dx: 0,
				loadStatus: ['loadmore','loadmore','loadmore','loadmore'],
			}
		},
		onLoad(options) {
			this.getxian(options.id)
			this.getpin(options.id)
		},
		methods: {
			getLike(index) {
				this.commentList[index].myLikeState = !this.commentList[index].myLikeState;
				if (this.commentList[index].myLikeState == true) {
					this.commentList[index].likeCount++;
				} else {
					this.commentList[index].likeCount--;
				}
			},
			getpin(id){
				this.$get(this.base+'/prod-api/api/lawyer-consultation/lawyer/list-evaluate',{
					lawyerId:id
				}).then((res)=>{
					this.commentList = res.rows
					console.log(res.rows)
				})
			},
			getxian(id){
				this.$get(this.base+'/prod-api/api/lawyer-consultation/lawyer/'+id).then((res)=>{		
					this.reactive = res.data
				})
			},
			change(index) {
				this.swiperCurrent = index;
				this.getOrderList(index);
			},
			transition({ detail: { dx } }) {
				this.$refs.tabs.setDx(dx);
			},
			animationfinish({ detail: { current } }) {
				this.$refs.tabs.setFinishCurrent(current);
				this.swiperCurrent = current;
				this.current = current;
			},
			toxia(){
				uni.navigateTo({
					url:'zzzzxun?id='+this.reactive.id
				})
			},
		}
	}
</script>

<style>
/* #ifndef H5 */
page {
	height: 100%;
	background-color: #f2f2f2;
}
/* #endif */
</style>

<style lang="scss" scoped>
.order {
	width: 710rpx;
	background-color: #ffffff;
	margin: 20rpx auto;
	border-radius: 20rpx;
	box-sizing: border-box;
	padding: 20rpx;
	font-size: 28rpx;
	.top {
		display: flex;
		justify-content: space-between;
		.left {
			display: flex;
			align-items: center;
			.store {
				margin: 0 10rpx;
				font-size: 32rpx;
				font-weight: bold;
			}
		}
		.right {
			color: $u-type-warning-dark;
		}
	}
	.item {
		display: flex;
		margin: 20rpx 0 0;
		.left {
			margin-right: 20rpx;
			image {
				width: 200rpx;
				height: 200rpx;
				border-radius: 10rpx;
			}
		}
		.content {
			.title {
				font-size: 28rpx;
				line-height: 50rpx;
			}
			.type {
				margin: 10rpx 0;
				font-size: 24rpx;
				color: $u-tips-color;
			}
			.delivery-time {
				color: #e5d001;
				font-size: 24rpx;
			}
		}
		.right {
			margin-left: 10rpx;
			padding-top: 20rpx;
			text-align: right;
			.decimal {
				font-size: 24rpx;
				margin-top: 4rpx;
			}
			.number {
				color: $u-tips-color;
				font-size: 24rpx;
			}
		}
	}
	.total {
		margin-top: 20rpx;
		text-align: right;
		font-size: 24rpx;
		.total-price {
			font-size: 32rpx;
		}
	}
	.bottom {
		display: flex;
		margin-top: 40rpx;
		padding: 0 10rpx;
		justify-content: space-between;
		align-items: center;
		.btn {
			line-height: 52rpx;
			width: 160rpx;
			border-radius: 26rpx;
			border: 2rpx solid $u-border-color;
			font-size: 26rpx;
			text-align: center;
			color: $u-type-info-dark;
		}
		.evaluate {
			color: $u-type-warning-dark;
			border-color: $u-type-warning-dark;
		}
	}
}
.centre {
	text-align: center;
	margin: 200rpx auto;
	font-size: 32rpx;
	image {
		width: 164rpx;
		height: 164rpx;
		border-radius: 50%;
		margin-bottom: 20rpx;
	}
	.tips {
		font-size: 24rpx;
		color: #999999;
		margin-top: 20rpx;
	}
	.btn {
		margin: 80rpx auto;
		width: 200rpx;
		border-radius: 32rpx;
		line-height: 64rpx;
		color: #ffffff;
		font-size: 26rpx;
		background: linear-gradient(270deg, rgba(249, 116, 90, 1) 0%, rgba(255, 158, 1, 1) 100%);
	}
}
.wrap {
	display: flex;
	flex-direction: column;
	height: calc(100vh - var(--window-top));
	width: 100%;
}
.swiper-box {
	flex: 1;
}
.swiper-item {
	height: 100%;
}
</style>
<style lang="scss" scoped>
.comment {
	display: flex;
	padding: 30rpx;
	.left {
		image {
			width: 64rpx;
			height: 64rpx;
			border-radius: 50%;
			background-color: #f2f2f2;
		}
	}
	.right {
		flex: 1;
		padding-left: 20rpx;
		font-size: 30rpx;
		.top {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 10rpx;
			.name {
				color: #5677fc;
			}
			.like {
				display: flex;
				align-items: center;
				color: #9a9a9a;
				font-size: 26rpx;
				.num {
					margin-right: 4rpx;
					color: #9a9a9a;
				}
			}
			.highlight {
				color: #5677fc;
				.num {
					color: #5677fc;
				}
			}
		}
		.content {
			margin-bottom: 10rpx;
		}
		.reply-box {
			background-color: rgb(242, 242, 242);
			border-radius: 12rpx;
			.item {
				padding: 20rpx;
				border-bottom: solid 2rpx $u-border-color;
				.username {
					font-size: 24rpx;
					color: #999999;
				}
			}
			.all-reply {
				padding: 20rpx;
				display: flex;
				color: #5677fc;
				align-items: center;
				.more {
					margin-left: 6rpx;
				}
			}
		}
		.bottom {
			margin-top: 20rpx;
			display: flex;
			font-size: 24rpx;
			color: #9a9a9a;
			.reply {
				color: #5677fc;
				margin-left: 10rpx;
			}
		}
	}
}
</style>


